-
Notifications
You must be signed in to change notification settings - Fork 90
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Adding ParameterCollection.where for conditional parameter iteration #1899
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Allows selective iteration of parameters that meet, by their definition not their value, meet a certain condition. This would be useful to iterate over all parameters on a ``Block`` that are relevant for neutronics calculations with ```python for p in block.p.where(lambda pd: "neutronics" in pd.categories): ... ``` The argument is a function that should return true for a given parameter and can be complicated ```python block.p.where( lambda pd: ( pd.atLocation(ParamLocation.EDGES) or pd.atLocation(ParamLocation.CORNERS) ) ) ``` Closes #1898
(cherry picked from commit 4162cd7)
* main: Fixing a problem with the latest release of h5py (#1907)
john-science
changed the title
Provide ParameterCollection.where for efficient conditional iteration of parameters
Adding ParameterCollection.where for conditional parameter iteration
Sep 25, 2024
Co-authored-by: John Stilley <[email protected]>
john-science
approved these changes
Sep 25, 2024
drewj-tp
added a commit
that referenced
this pull request
Sep 26, 2024
…rams/1860 * origin/main: Adding ParameterCollection.where for conditional parameter iteration (#1899) Removing non-existent settings from test files (#1906) Removing reference to deprecated internal files (#1897) Fixing a problem with the latest release of h5py (#1907) Providing plugin hook getAxialExpansionChanger (#1870) Fixing typo in new settingsValidation imports (#1905) Startinf moving settingsValidation to the settings area (#1895)
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What is the change?
Provide
ParameterCollection.where()
for better iteration of parametersAllows selective iteration of parameters that meet, by their definition
not their value, a certain condition. This would be useful to
iterate over all parameters on a
Block
that are relevant forneutronics calculations with:
The argument is a function that should return true for a given parameter
and can be complicated:
Why is the change being made?
Inspired by
HexBlock
rotation where we need to do stuff for parameters that meet certain criteria.Closes #1898
Checklist
doc
folder.pyproject.toml
.